import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams, ModalController, Item } from 'ionic-angular';
import { COMBO_DATA } from '../../../common/combo'
import { ApiProvider } from '../../../providers/api/api';
import { NotificationProvider } from '../../../providers/notification/notification';
import { StorageProvider } from '../../../providers/storage/storage';
import { ToolProvider } from '../../../providers/tool/tool';
import { Observable } from 'rxjs';
import { HttpParams } from '@angular/common/http';
import { ZBar, ZBarOptions } from '@ionic-native/zbar';
import { PAGE_COUNT } from '../../../app/app.constants';

/**
 * Generated class for the SerspinDetailPage page.
 *
 * See https://ionicframework.com/docs/components/#navigation for more info on
 * Ionic pages and navigation.
 */

@IonicPage()
@Component({
  selector: 'page-serspin-detail',
  templateUrl: 'serspin-detail.html',
})
export class SerspinDetailPage {
  private funid = 'sp_in_det';
  private spin:any;
  private details= []; //保存入库明细的数据


  constructor(  
    public navCtrl: NavController, 
    public navParams: NavParams, 
    private api: ApiProvider, 
    private notification: NotificationProvider, 
    private modalCtrl: ModalController,
    private storage: StorageProvider,
    private tool: ToolProvider,
    private zbar: ZBar
    ) {
      this.spin=navParams.get('spin');
  }

  ionViewDidLoad() {
    let options= {
      start: 0,
      limit: PAGE_COUNT,
      where_sql:'sp_in_det.in_id = ? ',
      where_type:'string',
      where_value:this.spin.sp_in__in_id
    };
    let res = this.api.getList(this.funid,options).subscribe(res => {
      if(res['success']){
        this.details = res['data']['root'];
      }else{
        this.notification.showAlert(res['message']); 
      } 
      this.notification.hideLoading(); 
    })
  }

  }
